﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="CarMaintenanceReport.ascx.cs" Inherits="CS424_9pts.Administration.Modules.CarMaintenanceReport" %>
<%@ Register Assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI.DataVisualization.Charting" TagPrefix="asp" %>

<div class="section-header">
    <div class="title">
        <img src="../Common/ico-sales.png" alt="Car Maintenance Report" />    
    </div>
    <div class="options">
    </div>
</div>

<asp:SqlDataSource  ID="SqlDataCarMaintenance" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:CarManagementConnectionString %>"
                    SelectCommand="SELECT MaintenanceID, ContractID, Date, Description, Subtotal, TaxID, Total, CurrencyID, Status FROM Maintenance" 
    DeleteCommand="DELETE FROM [Maintenance] WHERE [MaintenanceID] = @MaintenanceID" 
    InsertCommand="INSERT INTO [Maintenance] ([ContractID], [Date], [Description], [Subtotal], [TaxID], [Total], [CurrencyID], [Status]) VALUES (@ContractID, @Date, @Description, @Subtotal, @TaxID, @Total, @CurrencyID, @Status)" 
    
    
    UpdateCommand="UPDATE [Maintenance] SET [ContractID] = @ContractID, [Date] = @Date, [Description] = @Description, [Subtotal] = @Subtotal, [TaxID] = @TaxID, [Total] = @Total, [CurrencyID] = @CurrencyID, [Status] = @Status WHERE [MaintenanceID] = @MaintenanceID">
    <DeleteParameters>
        <asp:Parameter Name="MaintenanceID" Type="Int32" />
    </DeleteParameters>
    <InsertParameters>
        <asp:Parameter Name="ContractID" Type="Int32" />
        <asp:Parameter Name="Date" Type="DateTime" />
        <asp:Parameter Name="Description" Type="String" />
        <asp:Parameter Name="Subtotal" Type="Double" />
        <asp:Parameter Name="TaxID" Type="Int32" />
        <asp:Parameter Name="Total" Type="Double" />
        <asp:Parameter Name="CurrencyID" Type="Int32" />
        <asp:Parameter Name="Status" Type="Int32" />
    </InsertParameters>
    <UpdateParameters>
        <asp:Parameter Name="ContractID" Type="Int32" />
        <asp:Parameter Name="Date" Type="DateTime" />
        <asp:Parameter Name="Description" Type="String" />
        <asp:Parameter Name="Subtotal" Type="Double" />
        <asp:Parameter Name="TaxID" Type="Int32" />
        <asp:Parameter Name="Total" Type="Double" />
        <asp:Parameter Name="CurrencyID" Type="Int32" />
        <asp:Parameter Name="Status" Type="Int32" />
        <asp:Parameter Name="MaintenanceID" Type="Int32" />
    </UpdateParameters>
</asp:SqlDataSource>

<asp:GridView ID="gvCarMaintenanceReport" runat="server" AllowPaging="True" 
    AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" 
    DataKeyNames="MaintenanceID" DataSourceID="SqlDataCarMaintenance" 
    ForeColor="#333333" GridLines="None" >
    <AlternatingRowStyle BackColor="White" />
    <Columns>
        <asp:BoundField DataField="MaintenanceID" HeaderText="MaintenanceID" 
            InsertVisible="False" ReadOnly="True" SortExpression="MaintenanceID" />
        <asp:BoundField DataField="ContractID" HeaderText="ContractID" 
            SortExpression="ContractID" />
        <asp:BoundField DataField="Date" HeaderText="Date" SortExpression="Date" />
        <asp:BoundField DataField="Description" HeaderText="Description" 
            SortExpression="Description" />
        <asp:BoundField DataField="Subtotal" HeaderText="Subtotal" 
            SortExpression="Subtotal" />
        <asp:BoundField DataField="TaxID" HeaderText="TaxID" SortExpression="TaxID" />
        <asp:BoundField DataField="Total" HeaderText="Total" SortExpression="Total" />
        <asp:BoundField DataField="CurrencyID" HeaderText="CurrencyID" 
            SortExpression="CurrencyID" />
        <asp:BoundField DataField="Status" HeaderText="Status" 
            SortExpression="Status" />
    </Columns>
    <EditRowStyle BackColor="#2461BF" />
    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
    <RowStyle BackColor="#EFF3FB" />
    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
    <SortedAscendingCellStyle BackColor="#F5F7FB" />
    <SortedAscendingHeaderStyle BackColor="#6D95E1" />
    <SortedDescendingCellStyle BackColor="#E9EBEF" />
    <SortedDescendingHeaderStyle BackColor="#4870BE" />
</asp:GridView>
